import { reqCategoryList, reqBannerList, reqFloorList } from '@/api'

const state = {
    categoryList: [],
    bannerList: [],
    floorList: []
}
const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList;
    },
    BANNERLIST(state, bannerList) {
        state.bannerList = bannerList;
    },
    FLOORLIST(state, floorList) {
        state.floorList = floorList;
    }
}
const actions = {
    async categoryList({ commit }) {
        const res = await reqCategoryList();
        if (res.code == 200) {
            commit("CATEGORYLIST", res.data);
        }
        console.log(res)
    },
    async getBannerList({ commit }) {
        const res = await reqBannerList();
        if (res.code == 200) {
            commit("BANNERLIST", res.data);
        }
        console.log(res)
    },
    async getFloorList({ commit }) {
        const res = await reqFloorList();
        if (res.code == 200) {
            commit("FLOORLIST", res.data);
        }
        console.log(res)
    }
}
const getters = {}

export default {
    state,
    mutations,
    actions,
    getters
}